import { Component, Input, OnInit } from '@angular/core';

@Component({
  selector: 'app-hydrogeology',
  templateUrl: './hydrogeology.component.html',
  styleUrls: ['./hydrogeology.component.scss']
})
export class HydrogeologyComponent implements OnInit {

  @Input() keys: any
  @Input() properties: any

  public data: Array<any> = []

  constructor() { }

  private dataFormate() {
    (this.keys || []).forEach(key => {
      this.data.push({
        key: key,
        value: this.properties[key]
      })
    })
  }

  ngOnInit() {
    this.dataFormate();
  }
  showView() {
    if (!this.properties) return;
    let { title, path, options } = this.properties;
    let url = `https://zk.cgsi.cn/mapview/?title=${title}&path=${path}&options=${options}`
    window.open(url)
  }

}
